<template>
	<view>
		<TabBar :activeIndex="1"></TabBar>
		<view class="right-content">
			<view class="tit">
				表决
			</view>
			  <view class="vote">
				<view class="result">
					{{item.contactsName}}进行表决！
				</view>
				<view class="radio">
					<u-radio-group
						v-model="vote"
						placement="row"
						:disabled="disabled"
					  >
						<u-radio
						  :customStyle="{paddingLeft: '50px',transform: 'scale(1.4)',marginTop: '5px'}"
						  v-for="(item, index) in votelist"
						  :key="index"
						  :label="item.name"
						  :name="item.name"
						>
						</u-radio>
					</u-radio-group>
				</view>
				<view class="operation">
					<u-button type="primary" :disabled="disabled" size="large" text="确认"  @click="confirm"></u-button>
				</view>
			  </view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				item:{},
				vote:'',
				// 基本案列数据
				  votelist: [{
					name: '同意',
					disabled: false
				  },
					{
					  name: '反对',
					  disabled: false
					},
					{
					  name: '弃权',
					  disabled: false
					}
				  ],
				  disabled:false
			}
		},
		methods: {
			confirm() {
				let that = this;
				console.log("vote",this.vote);
				if(!this.vote){
					uni.showToast({title: '未选择表决意见,请选择后再提交！',icon:'none', duration: 2000})
				}else{
					uni.showModal({
					    title: '表决',
					    content: "是否确认"+this.vote+"？",
					    success: function (res) {
					        if (res.confirm) {
								// const res = await request({
								// 	url: '/api/meeting/vote/'+this.item.id+'?vote='+this.vote
								// }).then(response => {
									// uni.showToast({title: '表决成功！',icon:'success', duration: 3000})
								// })
					            this.showAutograph=false;
								that.disabled = true;
								setTimeout(() => {
								  uni.navigateBack({
								  	delta: 1
								  })
								}, 3000)
					            
					        } 
					    }
					});
				}
			}
		},
		onLoad(option) {
			const item = JSON.parse(decodeURIComponent(option.item));
			this.item = item
			console.log(item)
		}
		 
	}
</script>

<style lang="scss">
	@import "@/static/css/_px2vw.scss";
	.tit{
		width: 100%;
		height: vw(50);
		text-align:center;
		background-color:rgb(64,158,255);
		line-height: vw(50);
		font-size:vw(20);
		color:#FFFFFF;
		font-family:'Arial Negreta', 'Arial Normal', 'Arial', sans-serif;
		font-weight:700;
		font-style:normal;
	}
	.vote{
		margin-top: vw(68);
		margin-left: vw(42);
		.result{
			font-size:vw(28);
			font-family:'Arial Negreta', 'Arial Normal', 'Arial', sans-serif;
		}
		.radio{
			margin-top: vw(58);
		}
		.operation{
			width: 10%;
			uni-button{
				height: vw(35);
				margin-top: vw(45);
				margin-left: vw(350);
				/deep/ uni-text{
					font-size:vw(18) !important;
				}
			}
		}
	}
</style>
